package net.zjitc.test;

import java.util.Scanner;

public class PrintPyramid {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        System.out.println("请输入要显示的金字塔的行数：");
        int row=sc.nextInt();
        /* 1、得到每层的空格数和星星数
         *  2、分别循环输出空格数和星星数*/
        for(int i=1;i<=row;i++){
            int blank=row-i;
            int star=2*i-1;
            for(int j=1;j<=blank;j++){
                System.out.print(" ");
            }
            for(int k=1;k<=star;k++){
                System.out.print("*");
            }
            System.out.println();
        }
    }
}
